UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xzfGvE3MSscLhGPla5zgfPjCy60SnJ232PQY97RfqOc=' 
WHERE 
  key_id = '40e81914839f75eb3c13d5dead3cbde7f2a9a8a950db444210b2e76e83fff584' 
  AND (
    token = 'xzfGvE3MSscLhGPla5zgfPjCy60SnJ232PQY97RfqOc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031