UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HlF37qGeVOGDiyYMGJ0BNj2lieVYtxZGZzlXSf3Yfp8=' 
WHERE 
  key_id = '38ea093ad73025c2bfc0e64ee30cf63428f978878366a4ce95c6d48da7a1f17c' 
  AND (
    token = 'HlF37qGeVOGDiyYMGJ0BNj2lieVYtxZGZzlXSf3Yfp8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027