UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XamAELgOR2H4VcLI6QlQBWxz79LXVDosDOmlxAj34Wc=' 
WHERE 
  key_id = '28f43e723d2afab38fa31bc9c6044b89cf5bd83c557e127cdc5f7c168d80155e' 
  AND (
    token = 'XamAELgOR2H4VcLI6QlQBWxz79LXVDosDOmlxAj34Wc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023