UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UuKDoqMhTy6UcK0xP8S5vwjVxl23ZMB4Mrh7ZLnvS/I=' 
WHERE 
  key_id = '3f71217095b87559541ad4df1532e89b835e35ca7e0ceb65e8b06a64f0694de6' 
  AND (
    token = 'UuKDoqMhTy6UcK0xP8S5vwjVxl23ZMB4Mrh7ZLnvS/I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035