UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0+uJImNSb+b+vnHaMWFLccv0CoChubqVcc2Mq/XYU+c=' 
WHERE 
  key_id = '9ec574e74823589d7860037a15e2832d5e2c7b056a7f33da2d464de435c1abdd' 
  AND (
    token = '0+uJImNSb+b+vnHaMWFLccv0CoChubqVcc2Mq/XYU+c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015