UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tov/lXfsL76F40R+EeXsVLkslOqPCtQPAkzvZ/Q8XoA=' 
WHERE 
  key_id = '1393b23c046620d2e9a799c525037afebab6d00acedb9db61015931a81d577e5' 
  AND (
    token = 'Tov/lXfsL76F40R+EeXsVLkslOqPCtQPAkzvZ/Q8XoA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046