UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ih9xdYdRRAwrnc/UeiF7sPyQwKELzS/wfozH99q/o4k=' 
WHERE 
  key_id = '4b9579ed780260951b3e328cf17f3319d9a68d29ec5c699209c3cb5af751216d' 
  AND (
    token = 'ih9xdYdRRAwrnc/UeiF7sPyQwKELzS/wfozH99q/o4k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045