UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UzQlheh0UMbxfg5UEZ5g+qUCGERSwMLuYI0jqjtlpT4=' 
WHERE 
  key_id = 'd361620c990ae729a6445f40fb8eb7dee2514472d9cfb0ab2399b339ae96bf13' 
  AND (
    token = 'UzQlheh0UMbxfg5UEZ5g+qUCGERSwMLuYI0jqjtlpT4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039