UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B8XnX4qjKL/nBHxOKb3OMpnwvO32Ugvy4tijZJN5EgY=' 
WHERE 
  key_id = '6d0d582fd0f60a2afba4591a34314169ab95432caef3b67b954844d2673d8652' 
  AND (
    token = 'B8XnX4qjKL/nBHxOKb3OMpnwvO32Ugvy4tijZJN5EgY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046