UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+iRMp6PXxvTMS7tDpWu/zvDjSOOywoTFf+gADSefon8=' 
WHERE 
  key_id = '9ef1998d14572181e20ac3af42be830ef92420200beb010f3bdf46924b72b455' 
  AND (
    token = '+iRMp6PXxvTMS7tDpWu/zvDjSOOywoTFf+gADSefon8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028