UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LNoI7nY1W+opQnVVM8qufUNTmhmr7+a0a2Ks+wMz1ms=' 
WHERE 
  key_id = '5479210f90b05ef7c8967045ecd35e7979df47a4b05ba9363e61f75602f1c4db' 
  AND (
    token = 'LNoI7nY1W+opQnVVM8qufUNTmhmr7+a0a2Ks+wMz1ms=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050