UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DEVGE5iYR0x4jAEq7tL6K9t7Y8yBUTQRs3ueisK42+M=' 
WHERE 
  key_id = 'b889759b2a903ca0ca9a561c51f566a8b7e5853349be469417447389d059c443' 
  AND (
    token = 'DEVGE5iYR0x4jAEq7tL6K9t7Y8yBUTQRs3ueisK42+M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031