UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xlvDFeE/wtD9fZ+1lPomGMAk77XzT6CrojLFU+Rr9Bk=' 
WHERE 
  key_id = 'd158c4022599c6b854a789b0b611e7f1daf95ea7df8ea9fe59f2f7dc56ecb40a' 
  AND (
    token = 'xlvDFeE/wtD9fZ+1lPomGMAk77XzT6CrojLFU+Rr9Bk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034