UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fQXpbmUxwux8lKwc7h37Qrvh77AwJnV7Ec/wTLqs+c0=' 
WHERE 
  key_id = 'b1a7152ee4849524b9408df141043283d1155489fb102e16b9be1f3813ff4ae8' 
  AND (
    token = 'fQXpbmUxwux8lKwc7h37Qrvh77AwJnV7Ec/wTLqs+c0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031