UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B/aXi7tJHRUL5ZWZSDkwmglUpBoE4obc630OrTkabl8=' 
WHERE 
  key_id = 'fc61049daec4d33c2e37cc6cc9a8047de8ab515afad3710508cfd46f23814f53' 
  AND (
    token = 'B/aXi7tJHRUL5ZWZSDkwmglUpBoE4obc630OrTkabl8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030