UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KhQQZ/VtXgIhA1a9KPskHUfw469GNhYbTBpAlStKF/Y=' 
WHERE 
  key_id = '7e6545d771b5bbe45f60967d3b97f620beefead58808d5f457870cbb9704c0b9' 
  AND (
    token = 'KhQQZ/VtXgIhA1a9KPskHUfw469GNhYbTBpAlStKF/Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051