UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aZ6xlL4+nPm2CqvC5FeUkHAuwbSh4tEzFivwCgATQVM=' 
WHERE 
  key_id = '360f25f06677bb01b4986fb20294092af322f8f560f682c374dc3842ac2c348b' 
  AND (
    token = 'aZ6xlL4+nPm2CqvC5FeUkHAuwbSh4tEzFivwCgATQVM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032