UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hgR41X8jRThCBH4ns8jrwnY/QeqsOOJmwu8wDlfkt6U=' 
WHERE 
  key_id = '323cbc17193d82e7a034964706f14e4e002cf6c80d157f29afb99be338dea166' 
  AND (
    token = 'hgR41X8jRThCBH4ns8jrwnY/QeqsOOJmwu8wDlfkt6U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037