UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5c10wdL0HRyd0MbtT/Qjd/aqzNMmj4dDwvEmqnzDcSU=' 
WHERE 
  key_id = 'e16f4649e2ed046328358e99249cb571d32a90ef460e970b02856ce20bcf2988' 
  AND (
    token = '5c10wdL0HRyd0MbtT/Qjd/aqzNMmj4dDwvEmqnzDcSU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045