UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Hd/52Vi0wY5bKYBbptNhfbEgneLiEUrpgkwWR99+j3Q=' 
WHERE 
  key_id = '14cdafe07885b0dbe187838d22414efc750304f83dc777855d0ca9bf0a77ebf3' 
  AND (
    token = 'Hd/52Vi0wY5bKYBbptNhfbEgneLiEUrpgkwWR99+j3Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026