UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BnM5a83YHFS0OuXP/KsFoBV28KZwr/VT+Ef0ksoT6Ww=' 
WHERE 
  key_id = '1e0b407533d351cfa4185437da049b52f619a3e069dba62fbe68a7738981eb2b' 
  AND (
    token = 'BnM5a83YHFS0OuXP/KsFoBV28KZwr/VT+Ef0ksoT6Ww=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037