UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xn+QY+JTjL1cUUwEsdVWtHuzvDiBaiSnAjuWHR4PRBo=' 
WHERE 
  key_id = '9ced10d0c4b0295e07148b62cf4715b68d163f0fcdca761ab317d370b627d318' 
  AND (
    token = 'xn+QY+JTjL1cUUwEsdVWtHuzvDiBaiSnAjuWHR4PRBo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037