UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N6WRcrwihuPMUnQoNnBE0THpdfgNqZHgIHFMCuBVDQ0=' 
WHERE 
  key_id = '0eb53ab1b9ff418c35f32770b372a252df802b36c92335e0ed792c722f8baade' 
  AND (
    token = 'N6WRcrwihuPMUnQoNnBE0THpdfgNqZHgIHFMCuBVDQ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059