UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XDOkuBLBOgp7WXhgMT1KSekE2A4I679gca4Wohlm8qY=' 
WHERE 
  key_id = '5c6bbe5f6cf47e448568ce73570cbe5bbdc228156c3263132b079c31453a7533' 
  AND (
    token = 'XDOkuBLBOgp7WXhgMT1KSekE2A4I679gca4Wohlm8qY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038