UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BMPuddefkRcJA432jF67P6G/SW7LcUrNeoIWZlhcHxc=' 
WHERE 
  key_id = '67c2badbb205b4611128ff9fa5650b87cccb658776596108182504a0f1c9dca9' 
  AND (
    token = 'BMPuddefkRcJA432jF67P6G/SW7LcUrNeoIWZlhcHxc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030