UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R2NSt5sY8ffeCCouX0fotspNv9cusXgqyIO4MycFsrw=' 
WHERE 
  key_id = '1aae1728aaa6e65e2703c4bc7bcb9bb723eac7086b1c45cc09126d3d5c2515ca' 
  AND (
    token = 'R2NSt5sY8ffeCCouX0fotspNv9cusXgqyIO4MycFsrw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030