UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yyJ7Vd5VqSrcNYkcX71yPRKKOMrJrpR+dDut/UysZeg=' 
WHERE 
  key_id = 'f66ab6b8a135ba05719280da0563b7da09351b7d743ac3e3537b2c07d5b42a03' 
  AND (
    token = 'yyJ7Vd5VqSrcNYkcX71yPRKKOMrJrpR+dDut/UysZeg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065