UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't87wG8WC+VEpJuN8BaLnpvKbKNDbtVPXghp/tF9c6MA=' 
WHERE 
  key_id = '40c1b82bbd445b78f73819ffdfc24e8869992ef703a42f4da110270f79f8d5e7' 
  AND (
    token = 't87wG8WC+VEpJuN8BaLnpvKbKNDbtVPXghp/tF9c6MA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031