UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kuOVoN29WMtWsrhJpEoD6lxMNE96uz/MjU3BIOjAKn8=' 
WHERE 
  key_id = '13b1f5a4e1cb1bff4175bf17e6abcddf5dd86be8b3a9c285d25024979c9097ff' 
  AND (
    token = 'kuOVoN29WMtWsrhJpEoD6lxMNE96uz/MjU3BIOjAKn8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00082