UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qtYlsh7tEOKpzOkFkbXyXFp1xYQK2PAGwyyUmBkCOnQ=' 
WHERE 
  key_id = 'dbea51b5bf20b814c63fb723438c320de9682de885e16b5cab819da7769bf164' 
  AND (
    token = 'qtYlsh7tEOKpzOkFkbXyXFp1xYQK2PAGwyyUmBkCOnQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019