UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UknJHADv05zDB6QsyxQgLLwIbN8I7TH+Q4Iy+uxZ4+4=' 
WHERE 
  key_id = 'c1862dc5e9e7485e71d8d77a536b872960b37f3bd2a038cedd47ec6814da811c' 
  AND (
    token = 'UknJHADv05zDB6QsyxQgLLwIbN8I7TH+Q4Iy+uxZ4+4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031