UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AmH6WSAF4PvfzkHjkFFw+iKBYmH2PWqGRdikaadODBk=' 
WHERE 
  key_id = 'bbb529b2fafbef7705cde4e2b9708861e42668c98d463990581148e9115f0334' 
  AND (
    token = 'AmH6WSAF4PvfzkHjkFFw+iKBYmH2PWqGRdikaadODBk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028