UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0HhZwBhs1z8TpMTg+BrbxLwukkIxWj5zQYeTyXOMi1E=' 
WHERE 
  key_id = 'a812bfccf53f53ee790ed3dce5856312896ea59968f6024cf0cbb773d77a6e95' 
  AND (
    token = '0HhZwBhs1z8TpMTg+BrbxLwukkIxWj5zQYeTyXOMi1E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024