UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Hs39VNo/CHXolU/Hxzuv2UGCRESHj0DVA68ZZyCxp/w=' 
WHERE 
  key_id = 'd21d4ab29943c69a307d7761c04073a9360b38640c2ab310bebf01b67bf36067' 
  AND (
    token = 'Hs39VNo/CHXolU/Hxzuv2UGCRESHj0DVA68ZZyCxp/w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026