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

Query time 0.00036