UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cqrtAFtx8zz3wNsunD9m2H/W/i4Ymn+5iRmkAeiBwSA=' 
WHERE 
  key_id = '290c514de2532136429c80cc84e4609c18b6b3ae8189e439d85a0f5224471dfc' 
  AND (
    token = 'cqrtAFtx8zz3wNsunD9m2H/W/i4Ymn+5iRmkAeiBwSA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037