UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wo+ctehboXeeGRUF1b6FsMqFVM27MU+G6I1e8J8RLW4=' 
WHERE 
  key_id = 'b102c6c7ba47120ebbe73a86eb405cbb05a347fc313755b557db2350a9ea9120' 
  AND (
    token = 'wo+ctehboXeeGRUF1b6FsMqFVM27MU+G6I1e8J8RLW4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045