UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'avHVYBRplnSw78frbDT/uodfow/AGDQbn2eteVTyzQw=' 
WHERE 
  key_id = '40ea873a712d480778e9da723fa3081e718c6410a7e6c4efc8520a9c9d9361df' 
  AND (
    token = 'avHVYBRplnSw78frbDT/uodfow/AGDQbn2eteVTyzQw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032